package com.baishui.gateway;

import com.baishui.gateway.service.GatewayServiceManage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


/**
 * @Component 必须添加，不然afterPropertiesSet该方法不会执行
 */
@Component
public class GateWayInit implements InitializingBean {
    private final static Logger log = LoggerFactory.getLogger(GateWayInit.class);

    @Autowired
    private GateWayServer gateWayServer;

    @Autowired
    private GatewayServiceManage gatewayServiceManage;

    @Override
    public void afterPropertiesSet() throws Exception {
        try {
            gatewayServiceManage.init();
            gateWayServer.deployVerticle();
        } catch (Exception exception) {
            log.error("");
        }
    }
}
